{% extends 'cms/base.html' %}
{% block title %}发布课程{% endblock %}
{% block header %}
    <!-- select2-bootstrap4  -->
    <link rel="stylesheet" href="{% static 'adminLTE/plugins/select2/css/select2.min.css' %}">
    <link rel="stylesheet" href="{% static 'adminLTE/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}">

{% endblock %}
{% block footer %}
    <!-- ueditor  -->
    <script src="{% static 'ueditor/ueditor.config.js' %}"></script>
    <script src="{% static 'ueditor/ueditor.all.min.js' %}"></script>
    <script src="{% static 'ueditor/lang/zh-cn/zh-cn.js' %}"></script>
    <!-- select2-bootstrap4  -->
    <script src="{% static 'adminLTE/plugins/select2/js/select2.full.min.js' %}"></script>
    <!-- qiniu  -->
{#    <script src="https://unpkg.com/qiniu-js@2.5.5/dist/qiniu.min.js"></script>#}
    <script type="text/javascript">
        //Initialize Select2 Elements
        $('.select2bs4').select2({
            theme: 'bootstrap4'
        })

        function Course() {
            var self = this
        }
        Course.prototype.createEditor = function () {
            var self = this
            var ue = UE.getEditor('ueditor', {
                initialFrameHeight: 400,
                serverUrl: '/ueditor/upload/',
            })
        }
        Course.prototype.run = function () {
            var self = this
            self.createEditor()

        }
        $(function () {
            var course = new Course()
            course.run()
        })
    </script>
{% endblock %}
{% block content-header %}
    发布新闻
{% endblock %}
{% block content %}
    <div class="row">
        <div class="col-lg-12">
            <div class="card card-primary card-outline">
                <div class="card-header">
                    <h3 class="card-title">发布课程</h3>
                </div>
                <form role="form">
                    <div class="card-body">
                        <div class="form-group">
                            <label>标题</label>
                            <input type="text" class="form-control" placeholder="标题" name="title">
                        </div>
                        <div class="form-group">
                            <label>分类</label>
                            <select class="custom-select select2bs4" name="category">
                                <option value="0">--请选择分类--</option>
                                {#                                {% for category in categories %}#}
                                {#                                    <option value={{ category.id }}>{{ category.name }}</option>#}
                                {#                                {% endfor %}#}
                            </select>
                        </div>
                        <div class="form-group">
                            <label>讲师</label>
                            <select class="custom-select select2bs4" name="category">
                                <option value="0">--请选择讲师--</option>
                                {#                                {% for teacher in teachers %}#}
                                {#                                    <option value={{ teacher.id }}>{{ teacher.username }}</option>#}
                                {#                                {% endfor %}#}
                            </select>
                        </div>
                        <div class="form-group">
                            <label>视频地址</label>
                            <input type="text" class="form-control" placeholder="视频地址" name="video_url">
                        </div>
                        <div class="form-group">
                            <label>封面</label>
                            <input type="text" class="form-control" placeholder="封面图" name="cover_url">
                        </div>
                        <div class="form-group">
                            <label>价格</label>
                            <input type="text" class="form-control" placeholder="价格" name="price">
                        </div>
                        {#                        <div class="form-group">#}
                        {#                            <label>封面</label>#}
                        {#                            <div class="input-group">#}
                        {#                                <input type="text" class="form-control" placeholder="封面地址" name="thumbnail"#}
                        {#                                       value="{{ news.thumbnail }}">#}
                        {#                                <span class="input-group-append">#}
                        {#                                    <button type="button" class="btn btn-default upload-file-server">上传至服务器</button>#}
                        {#                                </span>#}
                        {#                                <span class="input-group-append">#}
                        {#                                    <button type="button" class="btn btn-primary upload-file-qiniu">上传至七牛云</button>#}
                        {#                                </span>#}
                        {#                            </div>#}
                        {#                            <div class="progress" style="display: none">#}
                        {#                                <div class="progress-bar bg-primary progress-bar-striped" role="progressbar"#}
                        {#                                     aria-valuemin="0" aria-valuemax="100" style="width: 0">0%#}
                        {#                                </div>#}
                        {#                            </div>#}
                        {#                        </div>#}
                        <div class="form-group">
                            <label>内容</label>
                            {#                            <textarea style="width: 100%;height: 150px;" name="content" id="editor"></textarea>#}
                            <script id="ueditor" type="text/plain"></script>
                        </div>
                    </div>
                    <!-- /.card-body -->

                    <div class="card-footer">
                        <button type="submit" class="btn btn-primary float-right submit-btn" data-pk="{{ news.id }}">
                            发布
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
{% endblock %}